<!DOCTYPE html>
<html>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>瓦片图层与地理投影 - WMTS瓦片图层</title>
  <style type="text/css">
    html,
    body {
      margin: 0px;
      height: 100%;
      width: 100%;
    }
    .container {
      width: 100%;
      height: 100%;
    }
  </style>
  <link rel="stylesheet" href="https://unpkg.com/maptalks/dist/maptalks.css" />
  <script
    type="text/javascript"
    src="https://unpkg.com/maptalks/dist/maptalks.min.js"
  ></script>
  <body>
    <div id="map" class="container"></div>

    <script>
      var url =
        'https://localhost:6443/arcgis/rest/services/hs_build/MapServer/WMTS/1.0.0/WMTSCapabilities.xml'

      maptalks.SpatialReference.loadWMTS(url, function (err, conf) {
        if (err) {
          throw new Error(err)
        }
        var params = conf[0]

        console.log(params)

        var tileLayer = new maptalks.TileLayer('tilelayer', params)
        var spatialReference = params.spatialReference

        var map = new maptalks.Map('map', {
          center: [114.499147, 30.554964],
          zoom: 15,
          spatialReference: spatialReference,
          baseLayer: tileLayer
        })
      })
    </script>
  </body>
</html>
